package com.thwj.project.push.enums;

import com.thwj.common.utils.WzDateUtil;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/***
 * 公众号消息 模板
 */
public enum PushTemplateEnum {

    /***
     * 模板ID
     * uKTY_DDDMtTBfAdDuC_lxxUT0p0PGD3npm8QzDiPycg
     * 开发者调用模板消息接口时需提供模板ID
     * 标题
     * 报名成功提醒
     * 行业
     * IT科技 - 互联网|电子商务
     * 详细内容
     * {{first.DATA}}
     * 活动时间：{{keyword1.DATA}}
     * 活动地点：{{keyword2.DATA}}
     * 活动主办方：{{keyword3.DATA}}
     * 活动报名详情：{{keyword4.DATA}}
     * {{remark.DATA}}
     */
    ACTIVITY_SIGN_UP_SUCCESS("活动报名成功","uKTY_DDDMtTBfAdDuC_lxxUT0p0PGD3npm8QzDiPycg"),

    /***
     * 模板ID
     * JV18fLNmihw8HDZRlG7qXTTgPSFrYucdX_fxnkHKo1E
     * 开发者调用模板消息接口时需提供模板ID
     * 标题
     * 活动取消通知
     * 行业
     * IT科技 - 互联网|电子商务
     * 详细内容
     * {{first.DATA}}
     * 活动名称：{{keyword1.DATA}}
     * 活动时间：{{keyword2.DATA}}
     * 发起人：{{keyword3.DATA}}
     * 取消原因：{{keyword4.DATA}}
     * {{remark.DATA}}
     *
     *
     */
    ACTIVITY_CANCEL("活动取消通知","JV18fLNmihw8HDZRlG7qXTTgPSFrYucdX_fxnkHKo1E"),
    /***
     * 模板ID
     * 49lvcXFwCvgdRlwWlsn9JQQkcv8xyWvnc0uX4N4xgE0
     * 开发者调用模板消息接口时需提供模板ID
     * 标题
     * 认证审核通知
     * 行业
     * IT科技 - 互联网|电子商务
     * 详细内容
     * {{first.DATA}}
     * 认证类型：{{keyword1.DATA}}
     * 真实姓名：{{keyword2.DATA}}
     * 审核状态：{{keyword3.DATA}}
     * 审核时间：{{keyword4.DATA}}
     * {{remark.DATA}}
     */
    AUTHTHENTICATION_AUDITING("认证审核通知","49lvcXFwCvgdRlwWlsn9JQQkcv8xyWvnc0uX4N4xgE0"),

    /***
     * 模板ID
     * SObSTu0OkOTR4xPIqy1Y-ovSXmoxxwK3Z0GIxPM4ceU
     * 开发者调用模板消息接口时需提供模板ID
     * 标题
     * 认证审核通知
     * 行业
     * IT科技 - 互联网|电子商务
     * 详细内容
     * {{first.DATA}}
     * 发起时间：{{keyword1.DATA}}
     * 认证类型：{{keyword2.DATA}}
     * {{remark.DATA}}
     *
     * 管理员
     *
     */
    AUTHTHENTICATION_COMMIT("认证提交通知","SObSTu0OkOTR4xPIqy1Y-ovSXmoxxwK3Z0GIxPM4ceU"),


    /***
     * 模板ID
     * PtX3bIM5bksA8dIUAf5MXI2tOsG2NBIgQOIXfp2BAlU
     * 开发者调用模板消息接口时需提供模板ID
     * 标题
     * 提现审核受理通知
     * 行业
     * IT科技 - 互联网|电子商务
     * 详细内容
     * {{first.DATA}}
     * 申请时间：{{keyword1.DATA}}
     * 提现方式：{{keyword2.DATA}}
     * 提现金额：{{keyword3.DATA}}
     * 手续费用：{{keyword4.DATA}}
     * 到账金额：{{keyword5.DATA}}
     * {{remark.DATA}}
     */
    WITHDRAW_FINISH("提现审核受理通知","PtX3bIM5bksA8dIUAf5MXI2tOsG2NBIgQOIXfp2BAlU"),


    /***
     * 通知后台人员审核
     *
     * 模板ID
     * 2_6dCqVO2ZXdqoqa-WiI-wW6zGfOme_rUvQ5NJn-UZM
     * 开发者调用模板消息接口时需提供模板ID
     * 标题
     * 提现审核提醒
     * 行业
     * IT科技 - 互联网|电子商务
     * 详细内容
     * {{first.DATA}}
     * 申请人：{{keyword1.DATA}}
     * 申请时间：{{keyword2.DATA}}
     * 提现金额：{{keyword3.DATA}}
     * {{remark.DATA}}
     */
    WITHDRAW_COMMIT("提现审核提醒","2_6dCqVO2ZXdqoqa-WiI-wW6zGfOme_rUvQ5NJn-UZM"),


    /****
     * 模板ID
     *     ruchTqZzah8r3iiceZzeI9pFawU3Sp4Q1cCoRyVMuxk
     *             开发者调用模板消息接口时需提供模板ID
     *     标题
     *             预约取消提醒
     *     行业
     *     IT科技 - 互联网|电子商务
     *             详细内容
     *     {{first.DATA}}
     *     预约姓名：{{keyword1.DATA}}
     *     预约项目：{{keyword2.DATA}}
     *     预约时间：{{keyword3.DATA}}
     *     {{remark.DATA}}
     */
    ACTIVITY_SIGN_UP_CANCEL("活动报名取消","ruchTqZzah8r3iiceZzeI9pFawU3Sp4Q1cCoRyVMuxk"),

    /***
     * 详细内容
     *
     * 门店名称
     * {{thing2.DATA}}
     * 预约项目
     * {{thing12.DATA}}
     * 预订时间
     * {{time4.DATA}}
     * 联系电话
     * {{phone_number8.DATA}}
     */
    MERCHANT_ACTIVITY_CREATE_SUCCESS("商家场地预定成功","pF88WMia9jizLKaxk4UtPiv2ufiuMKUciNLSsoTooyk"),

    ;
    PushTemplateEnum(String name , String code){
        this.name = name;
        this.code = code;
    }

    private String name;
    private String code;


    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }

    public static PushTemplateEnum getEnumByValue(String code){
        for (PushTemplateEnum typeEnum : PushTemplateEnum.values()) {
            if(typeEnum.code.equals(code)) {
                return typeEnum;
            }
        }
        return null;
    }

    /**8
     *    * {{first.DATA}}
     *      * 活动时间：{{keyword1.DATA}}
     *      * 活动地点：{{keyword2.DATA}}
     *      * 活动主办方：{{keyword3.DATA}}
     *      * 活动报名详情：{{keyword4.DATA}}
     * @param startDate
     * @param endDate
     * @param address
     * @param contactName
     * @param title
     * @return
     */

    public static List<WxMpTemplateData> getACTIVITY_SIGN_UP_SUCCESS_Data(Date startDate,Date endDate,String address,String title, String contactName){
        List<WxMpTemplateData> templateDataList = new ArrayList<>();
        String startDateStr = String.format(
                "%s-%s %s %s",
                WzDateUtil.date2String(startDate,WzDateUtil.TIME_FORMAT_L),
                WzDateUtil.date2String(endDate,WzDateUtil.TIME_FORMAT_L),
                WzDateUtil.getWeekOfDate(startDate),
                WzDateUtil.date2String(startDate,WzDateUtil.DATE_FORMAT_N)
        );
        templateDataList.add(new WxMpTemplateData("keyword1",startDateStr,""));
        templateDataList.add(new WxMpTemplateData("keyword2",address,""));
        templateDataList.add(new WxMpTemplateData("keyword3",title,""));
        templateDataList.add(new WxMpTemplateData("keyword4",contactName,""));
        return templateDataList;
    }

    /**
     *     活动名称：{{keyword1.DATA}}
     *      * 活动时间：{{keyword2.DATA}}
     *      * 发起人：{{keyword3.DATA}}
     *      * 取消原因：{{keyword4.DATA}}
     * @param startDate
     * @param endDate
     * @param cancelReason
     * @param contactName
     * @param title
     * @return
     */
    public static List<WxMpTemplateData> getACTIVITY_CANCEL_Data(Date startDate,Date endDate,String title,String contactName,String cancelReason){
        List<WxMpTemplateData> templateDataList = new ArrayList<>();
        String startDateStr = String.format(
                "%s-%s %s %s",
                WzDateUtil.date2String(startDate,WzDateUtil.TIME_FORMAT_L),
                WzDateUtil.date2String(endDate,WzDateUtil.TIME_FORMAT_L),
                WzDateUtil.getWeekOfDate(startDate),
                WzDateUtil.date2String(startDate,WzDateUtil.DATE_FORMAT_N)
        );
        templateDataList.add(new WxMpTemplateData("keyword1",startDateStr,""));
        templateDataList.add(new WxMpTemplateData("keyword2",title,""));
        templateDataList.add(new WxMpTemplateData("keyword3",contactName,""));
        templateDataList.add(new WxMpTemplateData("keyword4",cancelReason,""));
        return templateDataList;
    }

    /***
     *   * 认证类型：{{keyword1.DATA}}
     *      * 真实姓名：{{keyword2.DATA}}
     *      * 审核状态：{{keyword3.DATA}}
     *      * 审核时间：{{keyword4.DATA}}
     *
     * @param authTypeName
     * @param userName
     * @param statusName
     * @param auditDate
     * @return
     */
    public static List<WxMpTemplateData> getAUTHTHENTICATION_AUDITING_Data(String authTypeName,String userName,String statusName,Date auditDate){
        List<WxMpTemplateData> templateDataList = new ArrayList<>();
        templateDataList.add(new WxMpTemplateData("keyword1",authTypeName,""));
        templateDataList.add(new WxMpTemplateData("keyword2",userName,""));
        templateDataList.add(new WxMpTemplateData("keyword3",statusName,""));
        templateDataList.add(new WxMpTemplateData("keyword4",WzDateUtil.date2String(auditDate,WzDateUtil.TIME_FORMAT_A),""));
        templateDataList.add(new WxMpTemplateData("remark", "查看 ...待补充"));
        return templateDataList;
    }

    /***
     *  * 发起时间：{{keyword1.DATA}}
     *      * 认证类型：{{keyword2.DATA}}
     * @param authTypeName
     * @param createDate
     * @return
     */
    public static List<WxMpTemplateData> getAUTHTHENTICATION_COMMIT_Data(Date createDate, String authTypeName){
        List<WxMpTemplateData> templateDataList = new ArrayList<>();
        templateDataList.add(new WxMpTemplateData("keyword1",WzDateUtil.date2String(createDate,WzDateUtil.TIME_FORMAT_A),""));
        templateDataList.add(new WxMpTemplateData("keyword2",authTypeName,""));
        return templateDataList;
    }


    /***
     * 申请时间：{{keyword1.DATA}}
     * 提现方式：{{keyword2.DATA}}
     * 提现金额：{{keyword3.DATA}}
     * 手续费用：{{keyword4.DATA}}
     * 到账金额：{{keyword5.DATA}}
     * @param createDate
     * @return
     */
    public static List<WxMpTemplateData> getWITHDRAW_FINISH_Data(Date createDate, String withdrawType, BigDecimal amount,BigDecimal commission,BigDecimal actualAmount){
        List<WxMpTemplateData> templateDataList = new ArrayList<>();
        templateDataList.add(new WxMpTemplateData("keyword1",WzDateUtil.date2String(createDate,WzDateUtil.TIME_FORMAT_A),""));
        templateDataList.add(new WxMpTemplateData("keyword2",withdrawType,""));
        templateDataList.add(new WxMpTemplateData("keyword3",amount.toString(),""));
        templateDataList.add(new WxMpTemplateData("keyword4", "暂不收取手续费",""));
        templateDataList.add(new WxMpTemplateData("keyword5",actualAmount.toString(),""));
        return templateDataList;
    }



    /***
     * 申请人：{{keyword1.DATA}}
     * 申请时间：{{keyword2.DATA}}
     * 提现金额：{{keyword3.DATA}}
     * @param createDate
     * @return
     */
    public static List<WxMpTemplateData> getWITHDRAW_COMMIT_Data(String userName,Date createDate, BigDecimal amount){
        List<WxMpTemplateData> templateDataList = new ArrayList<>();
        templateDataList.add(new WxMpTemplateData("keyword1",userName,""));
        templateDataList.add(new WxMpTemplateData("keyword2",WzDateUtil.date2String(createDate,WzDateUtil.TIME_FORMAT_A),""));
        templateDataList.add(new WxMpTemplateData("keyword3",amount.toString(),""));
        return templateDataList;
    }

    /**
     *     预约姓名：{{keyword1.DATA}}
     *     预约项目：{{keyword2.DATA}}
     *     预约时间：{{keyword3.DATA}}
     */
    public static List<WxMpTemplateData> getACTIVITY_SIGN_UP_CANCEL_Data(String nickName,String title,Date createDate){
        List<WxMpTemplateData> templateDataList = new ArrayList<>();
        templateDataList.add(new WxMpTemplateData("keyword1",nickName,""));
        templateDataList.add(new WxMpTemplateData("keyword2",title,""));
        templateDataList.add(new WxMpTemplateData("keyword3",WzDateUtil.date2String(createDate,WzDateUtil.TIME_FORMAT_A),""));
        return templateDataList;
    }



    /**
     *      * 门店名称
     *      * {{thing2.DATA}}
     *      * 预约项目
     *      * {{thing12.DATA}}
     *      * 预订时间
     *      * {{time4.DATA}}
     *      * 联系电话
     *      * {{phone_number8.DATA}}
     */
    public static List<WxMpTemplateData> getMERCHANT_ACTIVITY_CREATE_SUCCESS_Data(String merchantName,String title,Date startDate, String userPhone){


        List<WxMpTemplateData> templateDataList = new ArrayList<>();
//        templateDataList.add(new WxMpTemplateData("thing2",merchantName,""));
//        templateDataList.add(new WxMpTemplateData("thing12",title,""));
//        templateDataList.add(new WxMpTemplateData("time4", WzDateUtil.date2String(startDate,WzDateUtil.TIME_FORMAT_H)));
//        templateDataList.add(new WxMpTemplateData("phone_number8", userPhone,""));
        return templateDataList;
    }


}
